<?php
defined('IN_ADMIN') or exit('No permission resources.');
$show_validator = $show_scroll = $show_dialog = 1;
include $this->admin_tpl('header', 'admin');
?>
<script type="text/javascript">
//校验手机号
function isTel(tel){
	if(!(/^1(3[0-9]|5[012356789]|8[0-9]|4[7]|7[678])\d{8}$/.test(tel)) && !(/^([0-9]{3,4}-)?[0-9]{7,8}$/.test(tel))) return "请输入正确的手机号或者电话";
	return true;
}

function checkForm(){
	var phone = $("input[name='organizer[phone]']").val();
	var email = $("input[name='organizer[email]']").val();
	var qq = $("input[name='organizer[qq]']").val();
	if(phone == '' && email == '' && qq == ''){
		alert("电话、邮箱和QQ至少填写一个");
		return false;
	} else {
		return true;
	}
}
$(document).ready(function(){
	$.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'220',height:'70'}, function(){this.close();$(obj).focus();})}});
	$('#organizername').formValidator({autotip:true,onshow:"<?php echo L('please_input_organizer_name')?>",onfocus:"<?php echo L('please_input_organizer_name')?>",oncorrect:"<?php echo L('right')?>"}).inputValidator({min:1,onerror:"<?php echo L('please_input_organizer_name')?>"});
	$('#phone').formValidator({
    	autotip:false,
    	onshow:'<?php echo L('please_input_phone')?>',
    	onfocus: '<?php echo L('please_input_phone_true')?>',
    	oncorrect: '<?php echo L('true')?>',
        empty:true}).functionValidator({fun:isTel});
	$('#email').formValidator({
    	autotip:false,
    	onshow:'<?php echo L('please_input_email')?>',
    	onfocus: '<?php echo L('please_input_email_true')?>',
    	oncorrect: '<?php echo L('true')?>',
        empty:true}).regexValidator({regexp: regexEnum.email,onerror: '<?php echo L('email_false')?>'});
	$('#qq').formValidator({
    	autotip:false,
    	onshow:'<?php echo L('please_input_qq')?>',
    	onfocus: '<?php echo L('please_input_qq_true')?>',
    	oncorrect: '<?php echo L('true')?>',
        empty:true}).regexValidator({regexp: regexEnum.qq,onerror: '<?php echo L('qq_false')?>'});
});
</script>
<h3 style="padding-left: 20px;padding-top: 10px">
<a href="javascript:history.back(-1);" style="font-size:14px;color: #0000FF"><em>返回上一级</em></a>
</h3>
<form method="post" action="?m=activity&c=manage&a=edit&id=<?php echo $info['id']?>" id="myform" onsubmit="return checkForm()">
	<div class="pad-10">
		<div class="col-tab">
			<div id="div_info_1" class="contentList pad-10">
				<table width="100%" class="table_form ">
					<tbody>
						<tr>
							<th width="200"><?php echo L('organizer_name')?>：</th>
							<td><input name="organizer[name]" id="organizername" class="input-text" type="text" size="40" value="<?php echo $info['name'];?>"></td>
						</tr>
						<tr>
							<th><?php echo L('organizer_logo')?>：</th>
							<td><?php echo form::images('organizer[logo]', 'logo', $info['logo'], 'organizer', '', 40)?><!-- <font color="red">为保证显示效果，请上传宽高为500*500的图片</font> --></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('organizer_link')?>：</th>
							<td><input name="organizer[link]" id="link" class="input-text" type="text" size="40" value="<?php echo $info['link']?>"></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('organizer_desc')?>：</th>
							<td><textarea rows="5" cols="60" name="organizer[desc]" id="desc"><?php echo $info['description']?></textarea></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('organizer_phone')?>：</th>
							<td><input type="text" name="organizer[phone]" id="phone" class="input-text" size="40" value="<?php echo $info['telephone']?>"></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('organizer_email')?>：</th>
							<td><input type="text" name="organizer[email]" id="email" class="input-text" size="40" value="<?php echo $info['email']?>"></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('organizer_qq')?>：</th>
							<td><input type="text" name="organizer[qq]" id="qq" class="input-text" size="40" value="<?php echo $info['qq']?>"></td>
						</tr>
						<tr>
							<th></th>
							<td><font color="red">电话、邮箱和QQ至少填写一个</font></td>
						</tr>
					</tbody>
				</table>
			</div>
			<div class="bk15"></div>
			<input name="dosubmit" type="submit"   <?php if($action_source=="contestant" || $action_source=="talent_categroy"){ ?>class="dialog "  <?php }else{ ?>class="button" <?php }?>id="dosubmit"  value="<?php echo L('submit')?>" >
		</div>
</div>
</form>

</body>
</html>